package com.atguigu.gmall.model.list;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 *  映射对象   映射到ES索引库    Lucene实现在  Document文档类型  数据类型
 *
 *   ES 索引库    ES自己裂变   自动进行分组  集群搭建
 *      1.  goods  主
 *      2.  goods  从
 *      =========
 *      3.  goods  主
 *      4.          从
 *      =========
 *      5.          主
 *      6.          从
 *
 *    三片
 */
@Document(indexName = "goods", type = "info", shards = 1, replicas = 0)
@Data
public class Goods implements Serializable {

    @Id //
    private Long id;//索引库的 唯一主键

    @Field(type = FieldType.Keyword, index = false)
    private String defaultImg;//type=FieldType 二种 分

    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String title;

    @Field(type = FieldType.Double)
    private Double price;

    @Field(type = FieldType.Date)
    private Date createTime; // 新品

    @Field(type = FieldType.Long)
    private Long tmId;

    @Field(type = FieldType.Keyword)
    private String tmName;

    @Field(type = FieldType.Keyword)
    private String tmLogoUrl;

    @Field(type = FieldType.Long)
    private Long category1Id;

    @Field(type = FieldType.Keyword)
    private String category1Name;

    @Field(type = FieldType.Long)
    private Long category2Id;

    @Field(type = FieldType.Keyword)
    private String category2Name;

    @Field(type = FieldType.Long)
    private Long category3Id;

    @Field(type = FieldType.Keyword)
    private String category3Name;

    @Field(type = FieldType.Long)
    private Long hotScore = 0L;// 综合  排序   热度评分    公平原则   练习

    @Field(type = FieldType.Nested)
    private List<SearchAttr> attrs;//平台属性集合

}
